Change in openvpn[master]: multi_io: walk the link sockets once in multi_io_wait()
A message that is not in the archive (sent off-list or not yet received): gerrit.1793094393000.I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20@gerrit.openvpn.net
Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email
to review the following change.
Change subject: multi_io: walk the link sockets once in multi_io_wait()
......................................................................
multi_io: walk the link sockets once in multi_io_wait()
multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus registered twice, and on Windows the first pass created an FD_ACCEPT event for them.
Walk the sockets once, arming the UDP sockets and registering only the TCP ones as listening sockets. Drop the mode check as well, since multi_io_wait() only runs in server mode.
---
M src/openvpn/multi_io.c
1 file changed, 7 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/2045/1
src/openvpn/multi_io.c +7 -17
@@ -168,27 +168,17 @@int status;unsigned int *persistent = &m->multi_io->tun_rwflags; -if (!tuntap_is_dco_win (m->top.c1.tuntap)) +for (int i =0 ; i < m->top.c1.link_sockets_num; i++) { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +struct link_socket *sock = m->top.c2.link_sockets[i]; + +if (proto_is_dgram (sock->info.proto)) { -socket_set_listen_persistent (m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); +multi_io_process_flags (&m->top, m->multi_io->es, sock,p2mp_iow_flags (m, sock)); } - } - -if (has_udp_in_local_list (&m->top.options)) - { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +else if (!tuntap_is_dco_win (m->top.c1.tuntap)) { -struct link_socket *sock = m->top.c2.link_sockets[i]; - -if ((m->top.options.mode ==MODE_SERVER ) &&proto_is_dgram (sock->info.proto)) - { -unsigned int flags =p2mp_iow_flags (m, sock); - -multi_io_process_flags (&m->top, m->multi_io->es, sock, flags); - } +socket_set_listen_persistent (sock, m->multi_io->es, &sock->ev_arg); } }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2045
Gerrit-PatchSet: 1
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: Arne Schwabe, Gianmarco De Gregori.
Răzvan Cojocaru has posted comments on this change by Gianmarco De Gregori. ( https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email )
Change subject: multi_io: walk the link sockets once in multi_io_wait()
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2045
Gerrit-PatchSet: 1
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Attention: Gianmarco De Gregori <[email protected]>
Gerrit-Comment-Date: Tue, 27 Oct 2026 10:57:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH 1/1 multi_io: walk the link sockets once in multi_io_wait()
In reply to a message not in the archiveFrom: Gianmarco De Gregori <[email protected]>
multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus registered twice, and on Windows the first pass created an FD_ACCEPT event for them.
Walk the sockets once, arming the UDP sockets and registering only the TCP ones as listening sockets. Drop the mode check as well, since multi_io_wait() only runs in server mode.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <[email protected]>
src/openvpn/multi_io.c +7 -17
@@ -168,27 +168,17 @@int status;unsigned int *persistent = &m->multi_io->tun_rwflags; -if (!tuntap_is_dco_win (m->top.c1.tuntap)) +for (int i =0 ; i < m->top.c1.link_sockets_num; i++) { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +struct link_socket *sock = m->top.c2.link_sockets[i]; + +if (proto_is_dgram (sock->info.proto)) { -socket_set_listen_persistent (m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); +multi_io_process_flags (&m->top, m->multi_io->es, sock,p2mp_iow_flags (m, sock)); } - } - -if (has_udp_in_local_list (&m->top.options)) - { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +else if (!tuntap_is_dco_win (m->top.c1.tuntap)) { -struct link_socket *sock = m->top.c2.link_sockets[i]; - -if ((m->top.options.mode ==MODE_SERVER ) &&proto_is_dgram (sock->info.proto)) - { -unsigned int flags =p2mp_iow_flags (m, sock); - -multi_io_process_flags (&m->top, m->multi_io->es, sock, flags); - } +socket_set_listen_persistent (sock, m->multi_io->es, &sock->ev_arg); } }
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH applied] Re: multi_io: walk the link sockets once in multi_io_wait()
This is a good change, and one of the places where the multi-socket patch really left a bit of an unorganized mess ;-) (and I remember having complained about the "if (has_udp...)" before, which does *another* walk over the list, just hidden better).
"git show" is hard to read here, but the side-by-side view in gerrit makes this really obvious.
BB all green (except for a spurious t_client failure in one instance).
Your patch has been applied to the master branch.
commit 486077fe500217ad7a3f5ecee4191f66580bbd0b
Author: Gianmarco De Gregori Date: Tue Oct 27 13:44:55 2026 +0100
multi_io: walk the link sockets once in multi_io_wait()
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40223.html
--
kind regards,
Gert Doering
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Gert Doering has uploaded a new patch set (#2) to the change originally created by Gianmarco De Gregori. ( https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by Răzvan Cojocaru
Change subject: multi_io: walk the link sockets once in multi_io_wait()
......................................................................
multi_io: walk the link sockets once in multi_io_wait()
multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus registered twice, and on Windows the first pass created an FD_ACCEPT event for them.
Walk the sockets once, arming the UDP sockets and registering only the TCP ones as listening sockets. Drop the mode check as well, since multi_io_wait() only runs in server mode.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40223.html
---
M src/openvpn/multi_io.c
1 file changed, 7 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/2045/2
src/openvpn/multi_io.c +7 -17
@@ -168,27 +168,17 @@int status;unsigned int *persistent = &m->multi_io->tun_rwflags; -if (!tuntap_is_dco_win (m->top.c1.tuntap)) +for (int i =0 ; i < m->top.c1.link_sockets_num; i++) { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +struct link_socket *sock = m->top.c2.link_sockets[i]; + +if (proto_is_dgram (sock->info.proto)) { -socket_set_listen_persistent (m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); +multi_io_process_flags (&m->top, m->multi_io->es, sock,p2mp_iow_flags (m, sock)); } - } - -if (has_udp_in_local_list (&m->top.options)) - { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +else if (!tuntap_is_dco_win (m->top.c1.tuntap)) { -struct link_socket *sock = m->top.c2.link_sockets[i]; - -if ((m->top.options.mode ==MODE_SERVER ) &&proto_is_dgram (sock->info.proto)) - { -unsigned int flags =p2mp_iow_flags (m, sock); - -multi_io_process_flags (&m->top, m->multi_io->es, sock, flags); - } +socket_set_listen_persistent (sock, m->multi_io->es, &sock->ev_arg); } }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2045
Gerrit-PatchSet: 2
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Gert Doering has submitted this change. ( https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email )
Change subject: multi_io: walk the link sockets once in multi_io_wait()
......................................................................
multi_io: walk the link sockets once in multi_io_wait()
multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus registered twice, and on Windows the first pass created an FD_ACCEPT event for them.
Walk the sockets once, arming the UDP sockets and registering only the TCP ones as listening sockets. Drop the mode check as well, since multi_io_wait() only runs in server mode.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40223.html
---
M src/openvpn/multi_io.c
1 file changed, 7 insertions(+), 17 deletions(-)
src/openvpn/multi_io.c +7 -17
@@ -168,27 +168,17 @@int status;unsigned int *persistent = &m->multi_io->tun_rwflags; -if (!tuntap_is_dco_win (m->top.c1.tuntap)) +for (int i =0 ; i < m->top.c1.link_sockets_num; i++) { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +struct link_socket *sock = m->top.c2.link_sockets[i]; + +if (proto_is_dgram (sock->info.proto)) { -socket_set_listen_persistent (m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); +multi_io_process_flags (&m->top, m->multi_io->es, sock,p2mp_iow_flags (m, sock)); } - } - -if (has_udp_in_local_list (&m->top.options)) - { -for (int i =0 ; i < m->top.c1.link_sockets_num; i++) +else if (!tuntap_is_dco_win (m->top.c1.tuntap)) { -struct link_socket *sock = m->top.c2.link_sockets[i]; - -if ((m->top.options.mode ==MODE_SERVER ) &&proto_is_dgram (sock->info.proto)) - { -unsigned int flags =p2mp_iow_flags (m, sock); - -multi_io_process_flags (&m->top, m->multi_io->es, sock, flags); - } +socket_set_listen_persistent (sock, m->multi_io->es, &sock->ev_arg); } }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2045
Gerrit-PatchSet: 2
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel